﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;

public partial class Rondo : System.Web.UI.MasterPage
{
    private LocalFunctions _func = null;
    protected string sFooterText;
    public LocalFunctions FUNC
    {
        get
        {
            if (_func == null)
                _func=new LocalFunctions();
            return _func;
        }
    }
    string SelectedStyle = "color: #fff; font-weight:bold;";

    protected void Page_Load(object sender, EventArgs e)
    {
        if (FUNC.LangID == 1)
        {
            AddDynamicCss("style.css");
            Page.Culture = "ru-RU";
        }
        else
        {
            AddDynamicCss("styleHEB.css");
            Page.Culture = "he-IL";
        }
        //Hihttlight menu
        switch (Request.Url.Segments[Request.Url.Segments.Length - 1].ToLower())
        {
            case "default.aspx":
                divMain.Attributes.Clear();
                divMain.Attributes.Add("class", "mainbghome");
                lnkMain.Attributes.Add("style",SelectedStyle);
                break;
            case "about.aspx":
                lnkAbout.Attributes.Add("style", SelectedStyle);
                break;
            case "gallery.aspx":
            case "photos.aspx":
            case "videogallery.aspx":
            case "videoarchive.aspx":
                lnkGallery.Attributes.Add("style", SelectedStyle);
                break;
            case "desk.aspx":
            case "article.aspx":
            case "events.aspx":
                lnkDesk.Attributes.Add("style", SelectedStyle);
                break;
            case "contacts.aspx":
                lnkContacts.Attributes.Add("style", SelectedStyle);
                break;
        }
        if (TopImages1 != null)
        {
            TopImages1.FUNC = FUNC;
        }

        // Get footer
        Dal.arParams.Clear();
        Dal.arParams.Add(FUNC.LangID);
        sFooterText=Dal.ExecuteDBspOneValue("RD_GetFooter", Dal.arParams).ToString();
    }

        

    private void AddDynamicCss(string sFileName)
    {
        mainStyle.Href = "~/style/" + sFileName;
        mainStyle.Attributes.Add("rel", "stylesheet");
        mainStyle.Attributes.Add("type", "text/css");
    }
    protected void lnkRussianText_Click(object sender, EventArgs e)
    {
        FUNC.SetLangID(1);
        Response.Redirect("default.aspx");
    }
    protected void lnkHebrewText_Click(object sender, EventArgs e)
    {
        FUNC.SetLangID(2);
        Response.Redirect("default.aspx");
    }
}
